<%@page import="java.util.ArrayList"%>
<%@page import="stti.model.to.DireccionTO"%>
<%@page import="stti.model.dao.DAODireccion"%>
<%@page import="javax.swing.text.Document"%>
<%@page import="java.util.FormatterClosedException"%>
<%@page import="javax.activity.ActivityRequiredException"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<jsp:useBean id="DAODireccion" scope="session" class="stti.model.dao.DAODireccion"></jsp:useBean>
<jsp:setProperty name="sesionSTTI" property="*" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>STUDIOCLICK - CONTACT</title>
<!-- CSS Files -->
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
<style type="text/css">
.sf-sub-indicator {
	behavior: url(css/iepngfix.htc)
}
</style>
<!-- End of CSS Files -->
<!-- Javascript Files -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="javascript/superfish.js"></script>
<script type="text/javascript" src="javascript/dd.min.js"></script>
<script type="text/javascript">
//<![CDATA[

		// initialise plugins
		$(document).ready(function() { 

			if ($('#slider').length == 1)
			{
				$('#slider').cycle({
						fx: 'fade',
						speed: 2000,
						timeout: 4000
				});
			}

			var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
		
			if (!ie6)
			{
				$('ul.sf-menu').superfish({ 
					delay:       1000,                            // one second delay on mouseout 
					animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
					speed:       'normal'                         // faster animation speed 
				}); 			
			}
			else
			{
				DD_belatedPNG.fix('#topbar, img, a, .commentbubble, .infobubble, .view-all, #category-picture1, #category-picture2, #category-picture3, #footer');
			}
    }); 
//]]>
function registrar(){
    document.forms["registro"].submit();
}
function cargarComunas(region){
    if(region > 0){
        $.get("ajax/listarComunas.jsp", { id_region:region }, function(data)
        {
            document.getElementById("lista_comuna").innerHTML = data;
        }, "html");
    }
}
function checkRut(){
    rut = document.getElementById("rut").value;
    resultado = false;
    if(rut!=""){
    $.get("ajax/checkRut.jsp", { rut:rut }, function(data)
    {       var r = data.toString();
            if(r.length > 3){
             document.getElementById("errorRut").innerHTML = data;
             document.getElementById("errorRut").style.display = "block";
            }
            else
            {
             document.getElementById("errorRut").style.display = "none";
             resultado = true;   
            }  
        }, "html");
    }    
    return resultado;
}
function checkLogin(){
    login = document.getElementById("login").value;
    resultado = false;
    if(login!=""){
    $.get("ajax/checkLogin.jsp", { login:login }, function(data)
    {       var r = data.toString();
            if(r.length > 1){
             document.getElementById("errorLogin").innerHTML = data;
             document.getElementById("errorLogin").style.display = "block";
            }
            else
            {
             document.getElementById("errorLogin").style.display = "none";
             resultado = true; 
            }  
        }, "html");
    }    
    return resultado;
}
function checkPassword(){
    resultado = false;
    if(document.getElementById("password").value != document.getElementById("rpt_password").value){
        var error = "<p><i><font color=\"red\">Password ingresada incorrecta, intente nuevamente.</font></i></p>";
        document.getElementById("errorPassword").innerHTML = error;
        document.getElementById("errorPassword").style.display = "block";
        return resultado;
    }
    else{
        document.getElementById("errorPassword").style.display = "none";
        resultado = true;
        return resultado;
    }
    
}
</script>
<!-- End of Javascript Files -->
</head>
<body>
<!-- Wrapper -->
<div id="wrapper">
	<!-- Top bar -->
	<div id="topbar">
		<!-- Logo -->
		<img class="logo" src="images/logo.png" alt="logo" />
		<!-- Menu -->
		<div id="secnav">
			<ul>
				<li> <a href="registro.jsp">SIGN UP</a> </li>
				<li class="noimg"> <a href="login.jsp">LOGIN</a> </li>
			</ul>
		</div>
		<div class="menu">
			<ul class="sf-menu">
				<li> <a  href="index.jsp">HOME</a></li>
				<li> <a href="about.html">ABOUT</a>
					<ul>
						<li class="first"><a href="about.html">TEAM</a></li>
						<li><a href="about.html">PHILOSOPHY</a></li>
						<li><a href="about.html">COMPANY</a></li>
						<li class="last"><a href="about.html">PRODUCTS</a>
							<ul>
								<li class="first"><a href="about.html">PRODUCT ONE</a></li>
								<li><a href="about.html">PRODUCT TWO</a></li>
								<li class="last"><a href="about.html">PRODUCT THREE</a></li>
							</ul>
						</li>
					</ul>
				</li>
				<li> <a href="portfolio.html">PORTFOLIO</a>
					<ul>
						<li><a href="portfolio.html">WEBDESIGN</a></li>
						<li><a href="portfolio.html">PHOTOS</a>
							<ul>
								<li class="first"><a href="portfolio.html">NATURE</a></li>
								<li><a href="portfolio.html">ANIMALS</a></li>
								<li class="last"><a href="portfolio.html">CITIES</a>
									<ul>
										<li class="first"><a href="portfolio.html">NEW YORK</a></li>
										<li><a href="portfolio.html">MONTREAL</a></li>
										<li class="last"><a href="portfolio.html">LAS VEGAS</a></li>
									</ul>
								</li>
							</ul>
						</li>
						<li class="last"><a href="portfolio.html">ARTS</a></li>
					</ul>
				</li>
				<li> <a href="blog.html">BLOG</a>
					<ul>
						<li class="first"><a href="blog.html">CATEGORY ONE</a></li>
						<li><a href="blog.html">CATEGORY TWO</a></li>
						<li class="last"><a href="blog.html">CATEGORY THREE</a></li>
					</ul>
				</li>
				<li> <a class="on" href="contact.html">CONTACT</a> </li>
			</ul>
		</div>
		<!-- End of Menu -->
	</div>
	<div class="clear"></div>
	<!-- End of Topbar -->
	<!-- Introtext -->
	<div class="subcategory-contact">
		<h1>OUR OFFICE +</h1>
		<ul>
			<li><a href="#">MONTREAL</a></li>
			<li class="contact">Phone : 514.123.1234</li>
			<li class="contact">montreal@studioclick.com</li>
			<li><a href="#">LOS ANGELES</a></li>
			<li class="contact">Phone : 251.123.1234</li>
			<li class="contact">losangeles@studioclick.com</li>
			<li><a href="#">NEW YORK</a></li>
			<li class="contact">Phone : 616.123.1234</li>
			<li class="contact">newyork@studioclick.com</li>
			<li><a href="#">HONK HONG</a></li>
			<li class="contact">Phone : 616.123.1234</li>
			<li class="contact">honkhong@studioclick.com</li>
		</ul>
	</div>
	<div id="introtext-contact">
		<h1>CONTACT US   +</h1>
		<p>Praesent id dolor et dolor viverra sagittis. Integer scelerisque quam nec est congue tempor eu ut metus. Etiam fringilla aliquam nulla eu bibendum. Ut cursus, ligula vel mollis hendrerit, est enim posuere velit, ultricies pretium tortor massa ut ipsum. Aenean a aliquet arcu.</p>
		<div class="clear"></div>
	</div>
	<!-- End of introtext -->
	<!-- Form -->
        <form id="registro" name="registro" action="registro.do" method="post">
	<div id="contactform"> <img class="map" src="images/googlemap.jpg" alt="map" />
		<div id="main">
                        <h1>RUT: </h1>
			<p>
                            <input type="text" name="rut" id="rut" class="rut"  onblur="checkRut()"/>
			</p>
                        <span id="errorRut" style="display:none"></span>
                        <br>
			<h1>NOMBRE COMPLETO: </h1>
			<p>
				<input type="text" name="nombre" id="nombre" class="nombre" />
			</p>
                        <br>
                        <h1>TEL&Eacute;FONO: </h1>
			<p>
				<input type="text" name="telefono" id="telefono" class="telefono" />
			</p>
                        <br>
                        <h1>REGI&Oacute;N: </h1>
                        <p>
                            <select name="region" id="region" class="region" onchange="cargarComunas(this.value)">
                            <%
                                ArrayList<DireccionTO>  Regiones = new ArrayList<DireccionTO>();
                                DAODireccion qry_regiones = new DAODireccion();
                                Regiones = qry_regiones.listaRegiones();
                                for(int i = 0; i < Regiones.size(); i++){
                                    out.println("<option value=\""+Regiones.get(i).getIdRegion()+"\">"+Regiones.get(i).getRegion()+"</option>"); 
                                }        	       	
        	         	%>
                            </select>
			</p>
                        <br>
                        <h1>COMUNA: </h1>
                        <p>
                            <div id="lista_comuna">
                                <select name="comuna" id="comuna" class="comuna">
                                <%
                                    ArrayList<DireccionTO>  Comunas = new ArrayList<DireccionTO>();
                                    Comunas = qry_regiones.listaComunas("1");
                                    for(int i = 0; i < Comunas.size(); i++){
                                        out.println("<option value=\""+Comunas.get(i).getIdComuna()+"\">"+Comunas.get(i).getComuna()+"</option>"); 
                                    }        	       	
                                %>
                                </select>
                            </div>
			</p>
                        <br>
                        <h1>DIRECCI&Oacute;N: </h1>
			<p>
                            <input type="text" name="direccion" id="direccion" class="direccion" />
                        </p>
                        <br>    
			<h1>EMAIL:</h1>
			<p>
				<input type="text" name="email" id="email" class="email" />
			</p>
                        <br>
                        <h1>LOGIN:</h1>
			<p>
                            <input type="text" name="login" id="login" class="login" onblur="checkLogin()" />
			</p>
                        <span id="errorLogin" style="display:none"></span>
                        <br>
                        <h1>PASSWORD:</h1>
			<p>
				<input type="password" name="password" id="password" class="password" />
			</p>
                        <br>
                        <h1>REPITA SU PASSWORD:</h1>
			<p>
                            <input type="password" name="rpt_password" onblur="checkPassword()" id="rpt_password" class="rpt_password" />
			</p>
                        <span id="errorPassword" style="display:none"></span>
                        <br>
			<p>
                            <input type="button" onClick="registrar()" class="button" value="REGISTRO" />
                            
			</p>
		</div>
	</div>
	<!-- End of form-->
        </form>
	<div class="clear"></div>
	<!-- Footer-->
	<div id="footer">
		<div class="info"> © 2009 StudioCLICK  |  DESIGNED AND DEVELOPPED BY <a href="#">DDSTUDIOS</a> </div>
		<div class="infonav"> <a href="#">HOME</a> | <a href="#">ABOUT</a> | <a href="#">PORTFOLIO</a> | <a href="#">BLOG</a> | <a href="#">CONTACT</a> </div>
	</div>
	<!-- End of footer-->
</div>
<!-- End of wrapper -->
</body>
</html>
